handler->hdl_list[num].addr = addr;
handler->hdl_list[num].size = size;
- if ( (handler->hdl_list[num].type = type) == HVM_PORTIO )
- handler->hdl_list[num].action.portio = action;
- else
- handler->hdl_list[num].action.mmio = action;
+ handler->hdl_list[num].action.ptr = action;
handler->num_slot++;
}
+void unregister_io_handler(
+ struct domain *d, unsigned long addr, unsigned long size, int type)
+{
+ struct hvm_io_handler *handler = &d->arch.hvm_domain.io_handler;
+ int i;
+
+ for ( i = 0; i < handler->num_slot; i++ )
+ if ( (handler->hdl_list[i].addr == addr) &&
+ (handler->hdl_list[i].size == size) &&
+ (handler->hdl_list[i].type == type) )
+ goto found;
+ return;
+
+ found:
+ memcpy(&handler->hdl_list[i],
+ &handler->hdl_list[handler->num_slot-1],
+ sizeof(struct io_handler));
+ handler->num_slot--;
+}
+
/*
* Local variables:
* mode: C
union {
portio_action_t portio;
mmio_action_t mmio;
+ void *ptr;
} action;
};
void register_io_handler(
struct domain *d, unsigned long addr, unsigned long size,
void *action, int type);
+void unregister_io_handler(
+ struct domain *d, unsigned long addr, unsigned long size, int type);
static inline int hvm_portio_intercept(ioreq_t *p)
{
register_io_handler(d, addr, size, action, HVM_PORTIO);
}
+static inline void unregister_portio_handler(
+ struct domain *d, unsigned long addr, unsigned long size)
+{
+ unregister_io_handler(d, addr, size, HVM_PORTIO);
+}
+
static inline void register_buffered_io_handler(
struct domain *d, unsigned long addr,
unsigned long size, mmio_action_t action)